#include <iostream>
#include <vector>
using namespace std;

class Observer; 
class Subject{
	public:
		virtual void Add(Observer *)=0;
		virtual void Notify()=0;
		virtual void DataChange(int )=0;
};

class Observer{
	private:
		Subject *s;
	public:
		Observer(Subject *t){
			s=t;
			s->Add(this);
		}
		virtual Update()=0;
};

class ConcreteObserver:public Observer{
	private:
		int y;
	public:
		void Update(int _x){
			y=_x;
		}
};

class ConcreteSubject:public Subject{
	private:
		int x;
		vector <Observer *> v;
	public:
		ConcreteSubject(){
			x=0;
		}
		ConcreteSubject(int _x){
			x=_x;
		}
		void Notify(){
			vector <Observer *>::iterator it;
			for (it=v.begin();it!=v.end();it++){
				(*it)->Update();
			}
		}
		void Add(Observer *t){
			v.push_back(t);
		}
		void DataChange(int _x){
			x=_x;
			Notify();
		}
};

int main(void){
	
	return 0;
}
